/**
 * 
 */
package com.alphasystem.commerce.common.xml.adapter;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.xml.bind.annotation.adapters.XmlAdapter;

/**
 * @author sali
 * 
 */
public class DateTimeAdapter extends XmlAdapter<String, Date> {

	private static final SimpleDateFormat DATE_TIME_FORMAT = new SimpleDateFormat(
			"yyyy-MM-dd'T'HH:mm:ss");

	@Override
	public Date unmarshal(String v) throws Exception {
		return DATE_TIME_FORMAT.parse(v);
	}

	@Override
	public String marshal(Date v) throws Exception {
		return DATE_TIME_FORMAT.format(v);
	}

}
